/*
 * @Author: hongbin
 * @Date: 2022-11-03 12:59:51
 * @LastEditors: hongbin
 * @LastEditTime: 2022-12-24 21:03:09
 * @Description:通过用户名查找 判断该名称是否被使用
 */
import { NextApiRequest, NextApiResponse } from "next";
import DB from "../mongodb";

export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
    const db = await DB;
    const { name } = req.query;
    const list = await db.collection("userInfo").find({ name }).toArray();
    console.log(list);
    res.json(list);
}
